package com.hqbzl.c1;

import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.vm.VM;

public class Testjol {
    public static void main2(String[] args) {
        System.out.println("===================== VM DESC =====================");
        System.out.println(VM.current().details());
        System.out.println("===================== Java Object Layout =====================");
        System.out.println(ClassLayout.parseInstance(new Object()).toPrintable());
        System.out.println("===================== Integer Layout =====================");
        System.out.println(VM.current().sizeOf(Integer.parseInt("1")));

    }

    public static void main1(String[] args) {
        //VM.current().sizeOf(Integer.parseInt("1"));
        Integer obj = Integer.valueOf(1);
        System.out.println(ClassLayout.parseInstance(obj).toPrintable());
        System.out.println("=======================================================");
        final ClassType obj11 = new ClassType();
        System.out.println(ClassLayout.parseInstance(obj11).toPrintable());
        System.out.println("=======================================================");
        final ClassType1 obj22 = new ClassType1();
        System.out.println(ClassLayout.parseInstance(obj22).toPrintable());
        System.out.println("=======================================================");
    }

    static class Person {

    }

    static class Teacher {
        private int age;
    }

    public static void main3(String[] args) {
        final Person person = new Person();
        System.out.println(ClassLayout.parseInstance(person).toPrintable());

        System.out.println("=======================================================");
        final Person person1 = new Person();
        person1.hashCode();
        System.out.println(ClassLayout.parseInstance(person1).toPrintable());

    }

    public static void main(String[] args) {
        int[] arr1 = new int[100];
        System.out.println(ClassLayout.parseInstance(arr1).toPrintable());
        System.out.println("=======================================================");
        Integer[] arr2 = new Integer[100];
        System.out.println(ClassLayout.parseInstance(arr2).toPrintable());
        System.out.println("=======================================================");
        final Person person = new Person();
        System.out.println(ClassLayout.parseInstance(person).toPrintable());
        System.out.println("=======================================================");
        final Teacher teacher = new Teacher();
        System.out.println(teacher.hashCode());
        System.out.println(ClassLayout.parseInstance(teacher).toPrintable());

    }
}
